import { PrismaClient } from '@prisma/client';
import { mockDeep, DeepMockProxy } from 'jest-mock-extended';
import type { Context, MockContext } from '../../types/prisma';

export function createMockContext(): MockContext {
  return {
    prisma: mockDeep<PrismaClient>({
      auditLog: {
        create: jest.fn(),
        findUnique: jest.fn(),
        findMany: jest.fn(),
        update: jest.fn(),
        delete: jest.fn(),
        deleteMany: jest.fn(),
        count: jest.fn(),
      },
    }),
  };
}

export function createContext(): Context {
  return {
    prisma: new PrismaClient(),
  };
}

export const prismaMock = mockDeep<PrismaClient>({
  auditLog: {
    create: jest.fn(),
    findUnique: jest.fn(),
    findMany: jest.fn(),
    update: jest.fn(),
    delete: jest.fn(),
    deleteMany: jest.fn(),
    count: jest.fn(),
  },
});
